/*    */ package bdSQL;
/*    */ 
/*    */ import java.text.SimpleDateFormat;
/*    */ import java.util.Calendar;
/*    */ import java.util.GregorianCalendar;
/*    */ 
/*    */ public class DataUtils
/*    */ {
/*    */   public static java.sql.Date stringToSqlDate(String data)
/*    */   {
/* 11 */     java.sql.Date result = null;
/* 12 */     SimpleDateFormat formater = new SimpleDateFormat("dd/MM/yyyy");
/*    */     try {
/* 14 */       java.util.Date parsedDate = formater.parse(data);
/* 15 */       result = new java.sql.Date(parsedDate.getTime());
/*    */     } catch (Exception e) {
/* 17 */       e.printStackTrace();
/*    */     }
/* 19 */     return result;
/*    */   }
/*    */ 
/*    */   public static java.sql.Date dataAtual() {
/* 23 */     Calendar cal = new GregorianCalendar();
/* 24 */     String data = cal.get(5) + "/" + (cal.get(2) + 1) + "/" + cal.get(1);
/*    */ 
/* 26 */     return stringToSqlDate(data);
/*    */   }
/*    */ 
/*    */   public static String horaAtual() {
/* 30 */     Calendar cal = new GregorianCalendar();
/* 31 */     String hora = cal.get(11) + ":" + cal.get(12);
/*    */ 
/* 33 */     return hora;
/*    */   }
/*    */ 
/*    */   public static java.sql.Date dataAnterior()
/*    */   {
/* 39 */     Calendar cal = new GregorianCalendar();
/* 40 */     int dia = cal.get(5);
/* 41 */     int mes = cal.get(2) + 1;
/* 42 */     int ano = cal.get(1);
/*    */ 
/* 44 */     if (dia == 1) {
/* 45 */       if ((mes == 1) || (mes == 2) || (mes == 4) || (mes == 6) || (mes == 8) || (mes == 9) || (mes == 11)) {
/* 46 */         dia = 31;
/* 47 */         mes--;
/*    */       } else {
/* 49 */         dia = 30;
/* 50 */         mes--;
/*    */       }
/*    */     }
/* 53 */     else dia--;
/*    */ 
/* 56 */     String data = dia + "/" + mes + "/" + ano;
/*    */ 
/* 58 */     return stringToSqlDate(data);
/*    */   }
/*    */ }

/* Location:           C:\apache-tomcat-6.0.35\webapps\sistrans\WEB-INF\classes\
 * Qualified Name:     bdSQL.DataUtils
 * JD-Core Version:    0.6.2
 */